Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature/extensions] CreateDetectorAction extends BaseExtensionRestHandler #726

Merged

Conversation

dbwiddis
Copy link
Member

NOTE: Requires merging SDK #246 first.

Description

Simplifies CreateDetectorAction by extending BaseExtensionRestHandler:

  • changes routes() to routeHandlers() which auto-checks the method and path
  • removes the unnecessary check for the method and path
  • renames the handler method to avoid name conflict/override

Issues Resolved

Fixes SDK #245

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@dbwiddis dbwiddis requested review from a team, owaiskazi19 and ryanbogan November 13, 2022 05:05
@dbwiddis dbwiddis force-pushed the baseresthandler branch 2 times, most recently from 609b9bf to 88c100e Compare November 15, 2022 00:17
@owaiskazi19
Copy link
Member

@dbwiddis rebase with feature/extensions?

public List<Route> routes() {
return List.of(new Route(POST, "/detectors"));
protected List<RouteHandler> routeHandlers() {
return List.of(new RouteHandler(POST, "/detectors", (r) -> handlePostRequest(r)));
Copy link
Member Author

@dbwiddis dbwiddis Nov 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@owaiskazi19 FYI, I tried to use the same shortened format as the RestHelloAction but the internal use of client and xContentRegistry inside a Function falls afoul of "must be final" (even though they are defined final!)

So I had to keep it as a standard method and do the lambda version of the Function inline here.

See here as well.

@dbwiddis dbwiddis merged commit a845bdb into opensearch-project:feature/extensions Nov 18, 2022
@dbwiddis dbwiddis deleted the baseresthandler branch November 18, 2022 22:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants